import re
def user_name(name, password):
   # "判断用户名密码是否合法！"
    result_name = re.compile(r"^[a-zA-Z][a-zA-Z0-9_]{4,20}$")
    result_password = re.compile(r"^[a-zA-Z]\w{6,18}")

    if result_name.match(name) and  result_password.match(password):
        print("登录成功")
    else:
        print("用户名或密码不合法请您重新输入")

def main():
    "main 总入口函数"
    name = input("请输入你的用户名：")
    password = input("请输入你的密码：")
    user_name(name, password)
if __name__ == '__main__':
    main()
